package com.atguigu.gmall.realtime.join;

import com.atguigu.gmall.realtime.app.BaseSQLApp;
import com.atguigu.gmall.realtime.util.SQLUtil;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

/**
 * @Author lzc
 * @Date 2023/4/23 14:23
 */
public class ConsumeLeftJoinWithSQLKafka extends BaseSQLApp {
    public static void main(String[] args) {
        new ConsumeLeftJoinWithSQLKafka().init(
            50003,
            2,
            "ConsumeLeftJoinWithSQLKafka"
        );
        
    }
    
    @Override
    protected void handle(StreamExecutionEnvironment env, StreamTableEnvironment tEnv) {
        tEnv.executeSql("create table ab(" +
                            "  id string, " +
                            "  name string, " +
                            "  age int " +
                            ")" + SQLUtil.getKafkaSourceDDL("ab_left", "json"));
        
        tEnv.sqlQuery("select * from ab").execute().print();
    
    }
}
